package com.zatech.cgnci.project.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("准备金计提调整DTO")
public class CgnciClaimReserveDTO {

    @ApiModelProperty("任务号(退回录入必填)")
    private String taskNo;

    @ApiModelProperty("提交审核标识：true")
    private Boolean flowTaskType;

    @ApiModelProperty("准备金ID(更新时必填)")
    private Long reserveId;

    @ApiModelProperty("立案号")
    @NotBlank(message = "立案号不能为空")
    private String caseNo;

    @ApiModelProperty("案件ID")
    @NotNull(message = "案件ID不能为空")
    private Long caseId;

    @ApiModelProperty("保单号")
    @NotBlank(message = "保单号不能为空")
    private String policyNo;

    @ApiModelProperty("项目名称")
    @NotBlank(message = "项目名称不能为空")
    private String  projectName;

    @ApiModelProperty("汇率约定方式(按数值/按日期)")
    @NotBlank(message = "汇率约定方式不能为空")
    private String rateType;

    @ApiModelProperty("汇率日期")
    private Date rateDate;

    @ApiModelProperty("汇率")
    private BigDecimal rate;

    @ApiModelProperty("备注")
    private String remarks;

    @ApiModelProperty(value = "当次计提/调整金额是否超过100万美元,码表值:isYes")
    private String isExceed;

    @ApiModelProperty("准备金明细")
    @Valid
    @NotEmpty(message = "准备金明细不能为空")
    private List<ReserveDetailDTO> details;

    @ApiModelProperty(value = "文件list")
    private List<AccessoryDTO> accessoryDTOList;

    @Data
    public static class ReserveDetailDTO {
        @ApiModelProperty("明细ID")
        private Long detailId;

        @ApiModelProperty("险种编码")
        @NotBlank(message = "险种编码不能为空")
        private String riskType;

        @ApiModelProperty("险种名称")
        @NotBlank(message = "险种名称不能为空")
        private String riskTypeName;

        @ApiModelProperty("结算币种")
        @NotBlank(message = "结算币种不能为空")
        private String settlementCurrency;

        @ApiModelProperty("调整前准备金(结算币种)")
        private BigDecimal beforeSettlementReserve;

        @ApiModelProperty("调整准备金(结算币种)")
        private BigDecimal settlementReserve;

        @ApiModelProperty("调整后准备金(结算币种)")
        private BigDecimal afterSettlementReserve;


        @ApiModelProperty("已批准准备金(结算币种)")
        private BigDecimal approvedReserve;

        @ApiModelProperty("最新调整准备金(结算币种)")
        @NotNull(message = "最新调整准备金不能为空")
        private BigDecimal adjustReserve;

        @ApiModelProperty("最新调整后准备金(结算币种)")
        private BigDecimal afterAdjustReserve;

        @ApiModelProperty("原始币种")
        @NotNull(message = "原始币种不能为空")
        private String originalCurrency;

        @ApiModelProperty("调整前准备金(原始币种)")
        private BigDecimal beforeOriginalReserve;

        @ApiModelProperty("调整准备金(原始币种)")
        private BigDecimal originalReserve;

        @ApiModelProperty("调整后准备金(原始币种)")
        private BigDecimal afterOriginalReserve;

        @ApiModelProperty("已批准准备金(原始币种)")
        private BigDecimal approvedReserveOriginal;

        @ApiModelProperty("最新调整准备金(原始币种)")
        private BigDecimal adjustReserveOriginal;

        @ApiModelProperty("最新调整后准备金(原始币种)")
        private BigDecimal afterAdjustReserveOriginal;

        @ApiModelProperty("备注")
        private String remark;
    }

    @Data
    public static class AccessoryDTO {

        @ApiModelProperty(value = "accId")
        private Long accId;

        @ApiModelProperty(value = "业务编号(关联业务表主键id)", hidden = true)
        private Long businessId;

        @ApiModelProperty(value = "业务号", hidden = true)
        private String businessNo;

        @ApiModelProperty(value = "业务类型（根据业务自定义业务类型进行区分）", hidden = true)
        private String businessType;

        @ApiModelProperty(value = "文件类型", hidden = true)
        private String accType;

        @ApiModelProperty(value = "上传节点", hidden = true)
        private String uploadNode;

        @ApiModelProperty(value = "附件云编号", hidden = true)
        private String fileId;

        @ApiModelProperty(value = "附件名称", hidden = true)
        private String fileName;

        @ApiModelProperty(value = "附件类型", hidden = true)
        private String fileType;

        @ApiModelProperty(value = "有效起期", hidden = true)
        private Date startTime;

        @ApiModelProperty(value = "有效止期", hidden = true)
        private Date endTime;

        @ApiModelProperty(value = "上传时间", hidden = true)
        @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT-8")
        private Date uploadTime;

        @ApiModelProperty(value = "状态（0：失败，1：成功）", hidden = true)
        private String status;

        @ApiModelProperty(value = "操作结果描述", hidden = true)
        private String msg;

        @ApiModelProperty(value = "删除标志位（0：未删除，1：已删除）", hidden = true)
        private Integer dr;

    }

} 